{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "周二要上什么课呢:新媒体分析、虚拟演播厅、数码插画\n",
      "周三要上什么课呢:APP设计原型、平台经济、形势与政策\n",
      "周四要上什么课呢:数码照片、文艺美学、流行文化\n",
      "周五要上什么课呢:python\n",
      "周二的课:新媒体分析、虚拟演播厅、数码插画\n",
      "周三的课:APP设计原型、平台经济、形势与政策\n",
      "周四的课:数码照片、文艺美学、流行文化\n",
      "周五的课:python\n"
     ]
    }
   ],
   "source": [
    "a=input('周二要上什么课呢:')\n",
    "b=input('周三要上什么课呢:')\n",
    "c=input('周四要上什么课呢:')\n",
    "d=input('周五要上什么课呢:')\n",
    "\n",
    "print('周二的课:%s'%a)\n",
    "print('周三的课:%s'%b)\n",
    "print('周四的课:%s'%c)\n",
    "print('周五的课:%s'%d)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "周二要上什么课呢:新媒体分析、虚拟演播厅、数码插画\n",
      "周三要上什么课呢:APP设计原型、平台经济、形势与政策\n",
      "周四要上什么课呢:数码照片、文艺美学、流行文化\n",
      "周五要上什么课呢:python\n",
      "周二的课：新媒体分析、虚拟演播厅、数码插画\n",
      "周三的课：APP设计原型、平台经济、形势与政策\n",
      "周四的课：数码照片、文艺美学、流行文化\n",
      "周五的课：python\n"
     ]
    }
   ],
   "source": [
    "#使用第一种format\n",
    "a=input('周二要上什么课呢:')\n",
    "b=input('周三要上什么课呢:')\n",
    "c=input('周四要上什么课呢:')\n",
    "d=input('周五要上什么课呢:')\n",
    "\n",
    "print(\"周二的课：{}\".format(a))\n",
    "print(\"周三的课：{}\".format(b))\n",
    "print(\"周四的课：{}\".format(c))\n",
    "print(\"周五的课：{}\".format(d))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "周二要上什么课呢:新媒体分析、虚拟演播厅、数码插画\n",
      "周三要上什么课呢:APP设计原型、平台经济、形势与政策\n",
      "周四要上什么课呢:数码照片、文艺美学、流行文化\n",
      "周五要上什么课呢:python\n",
      "周二的课:新媒体分析、虚拟演播厅、数码插画,\n",
      "周三的课:APP设计原型、平台经济、形势与政策,\n",
      "周四的课:数码照片、文艺美学、流行文化,\n",
      "周五的课:python,\n"
     ]
    }
   ],
   "source": [
    "#使用第二种format\n",
    "a=input('周二要上什么课呢:')\n",
    "b=input('周三要上什么课呢:')\n",
    "c=input('周四要上什么课呢:')\n",
    "d=input('周五要上什么课呢:')\n",
    "\n",
    "course=[a,b,c,d]\n",
    "print(\"周二的课:{0[0]},\".format(course))\n",
    "print(\"周三的课:{0[1]},\".format(course))\n",
    "print(\"周四的课:{0[2]},\".format(course))\n",
    "print(\"周五的课:{0[3]},\".format(course))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入查询日期：Monday\n",
      "请输入查询时间：3-5\n",
      "今天没课，但你还是要给我起来学习！\n"
     ]
    }
   ],
   "source": [
    "a=['Tuesday','3-5','新媒体分析']\n",
    "b=['Wednesday','3-4','平台经济']\n",
    "c=['Thusday','8-10','文艺美学']\n",
    "d=['Friday','3-5','python']\n",
    "\n",
    "date=input('请输入查询日期：')\n",
    "time=input('请输入查询时间：')\n",
    "if date ==a[0]:\n",
    "    if time ==a[1]:\n",
    "        print(a[2])\n",
    "    else:\n",
    "        print('今天没课，但你还是要给我起来学习！')\n",
    "elif date ==b[0]:\n",
    "    if time==b[1]:\n",
    "        print(b[2])\n",
    "    elif date ==c[0]:\n",
    "        if time==c[1]:\n",
    "            print(c[2])\n",
    "        elif date ==d[0]:\n",
    "            if time ==d[1]:\n",
    "                print(d[2])\n",
    "            else:\n",
    "                print('今天没课，但你还是要给我起来学习！')\n",
    "else:\n",
    "    print('今天没课，但你还是要给我起来学习！')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4, 10]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=[1,2,3,4]\n",
    "a.append(10)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4, 10, 2]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.append(2)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.count(2)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.index(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4, 10, 2]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.insert(0,0)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.pop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 2, 3, 4, 10]"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.remove(1)\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 2, 3, 4, 10]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.reverse()\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "min(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['李婉仪', '程小虹', '黄嘉雯', '黄伊达', '金冠', '陈敏杰', '李依晓', '李鸿其', '张若昀']\n",
      "[]\n"
     ]
    }
   ],
   "source": [
    "names=[\"李婉仪\",'程小虹','黄嘉雯','黄伊达','金冠','陈敏杰','李依晓','李鸿其','张若昀']\n",
    "renames=[]\n",
    "other_names=[]             \n",
    "names.count(\"李\")\n",
    "names.count('黄')\n",
    "names.count('小虹')            \n",
    "names.count('张')\n",
    "names.count('陈敏杰')\n",
    "for a in names:                    \n",
    "    if names.count(a)>=2:           \n",
    "        renames.append(a)\n",
    "    else:\n",
    "        other_names.append(a)\n",
    "print(other_names)\n",
    "print(renames)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "renames_times 0 \n",
      "李_rename_times 0\n",
      "小虹_rename_times 0\n"
     ]
    }
   ],
   "source": [
    "print('renames_times %s '%len(renames))\n",
    "print('李_rename_times %s'%renames.count('李'))\n",
    "print('小虹_rename_times %s'%renames.count('小虹'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "重名:['张若昀']\n"
     ]
    }
   ],
   "source": [
    "names1=['李婉仪','程小虹','黄嘉雯','黄伊达','张若昀','陈敏杰','李依晓','李鸿其','张若昀']\n",
    "names2=names1.copy()    \n",
    "names3=set(names2)      \n",
    "for a in names3:\n",
    "    if a in names2:\n",
    "       names1.remove(a)  \n",
    "print('重名:%s'%names1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入一行英文:Today is a sunny day\n",
      "letter:16个\n",
      "number:0个\n",
      "white_space:4个\n",
      "other:0个\n"
     ]
    }
   ],
   "source": [
    "a=input(\"请输入一行英文:\")\n",
    "letter=[]\n",
    "number=[]\n",
    "white_space=[]\n",
    "other=[]\n",
    "for b in a:\n",
    "    if b>='a' and b<='z' or b>='A' and b<='Z':\n",
    "        letter.append(b)\n",
    "    elif b in '0123456789':\n",
    "        number.append(b)\n",
    "    elif b==' ':\n",
    "        white_space.append(b)\n",
    "    else:\n",
    "        other.append(b)\n",
    "c=len(letter)\n",
    "d=len(number)\n",
    "e=len(white_space)\n",
    "f=len(other)\n",
    "print('letter:%s个'%c)\n",
    "print('number:%s个'%d)\n",
    "print('white_space:%s个'%e)\n",
    "print('other:%s个'%f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "写下你心目中的班长名字:李鸿其\n",
      "写下你心目中的班长名字:黄嘉雯\n",
      "写下你心目中的班长名字:李鸿其\n",
      "写下你心目中的班长名字:李鸿其\n",
      "写下你心目中的班长名字:李鸿其\n",
      "那么根据统计，李鸿其就是我们本班的班长！\n"
     ]
    }
   ],
   "source": [
    "student={'李婉仪':0,'张若昀':0,'李鸿其':0,'黄嘉雯':0,'陈可辛':0}\n",
    "count=0\n",
    "while count<5:\n",
    "    name=input(\"写下你心目中的班长名字:\")\n",
    "    if name=='李婉仪':\n",
    "       student['李婉仪']+=1\n",
    "    elif name=='张若昀':\n",
    "       student['张若昀']+=1\n",
    "    elif name=='李鸿其':\n",
    "       student['李鸿其']+=1\n",
    "    elif name=='黄嘉雯':\n",
    "       student['黄嘉雯']+=1\n",
    "    else:\n",
    "       student['陈可辛']+=1\n",
    "    count+=1\n",
    "\n",
    "max(student.values())\n",
    "for key,value in student.items():\n",
    "    if(value == max(student.values())):\n",
    "        print('那么根据统计，%s就是我们本班的班长！'%key)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
